<template>
  <view class="container">
    <view class="avatar" v-if="strplist.soure=='product'">
      <!-- 上传组件 -->
      <u-upload ref="product_img" name="product_img" :maxCount="6" :fileList="filelist" width="100" height="100"
        @delete="del" @afterRead="read" />
    </view>
    <view class="avatar" v-else>
      <!-- 上传组件 -->
      <u-upload ref="product_img" name="product_img" :maxCount="6" :fileList="filelist1" width="100" height="100"
        @delete="del1" @afterRead="read1" />
    </view>

    <view class="content" v-if="strplist.soure == 'product'">
      <u-form labelPosition="left" labelWidth="60" :model="strplist" :rules="rules" ref="product">
        <!-- 部门 -->
        <u-form-item label="门店" prop="store" borderBottom @click="showstore = true">
          <u-input v-model="strplist.store.name" disabled disabledColor="#ffffff" placeholder="请选择所属门店"
            border="none"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <u-form-item label="商品分类" prop="store" borderBottom @click="showtype = true">
          <u-input v-model="strplist.product.typename_text" disabled inputAlign="center" disabledColor="#ffffff"
            placeholder="请选择商品所属分类" border="none"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <!-- 品牌 -->
        <u-form-item label="品牌" prop="brank" borderBottom @click="showbrank = true">
          <u-input v-model="strplist.product.brankname_text" disabled disabledColor="#ffffff" placeholder="请选择品牌"
            border="none"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <u-form-item label="系列" prop="branktype" borderBottom @click="showbranktype = true">
          <u-input v-model="strplist.product.btypename_text" disabled disabledColor="#ffffff" placeholder="请选择系列"
            border="none"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <u-form-item label="推荐栏:  " borderBottom @click="showsellcolumn = true">
          <u-input v-model="strplist.product.sellcolumn_text" inputAlign="center" disabled disabledColor="#ffffff"
            placeholder="请选择是否推荐" border="none"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <!-- 名称 -->
        <u-form-item label="型号">
          <u-input v-model="strplist.product.code" placeholder="请输入手表型号" />
        </u-form-item>
        <u-form-item label="审批状态">
          <u-input v-model="strplist.status_text" placeholder="审批状态未知" />
        </u-form-item>
        <u-form-item label="名称">
          <u-input v-model="strplist.goodsname" placeholder="商品名称位置" />
        </u-form-item>
        <u-form-item label="客户昵称">
          <u-input v-model="strplist.business.nickname" placeholder="请输入客户昵称" />
        </u-form-item>
        <u-form-item label="客户电话">
          <u-input v-model="strplist.business.mobile" placeholder="请输入客户电话" />
          <u-button
          slot="right"
          :customStyle="{
            width: '40px',
            height: '35px',
            marginLeft: '3px',
          }"
          @tap="getbusinessPhone"
          :text="tips"
          type="success"
          :plain="true"
          size="mini"
        ></u-button>
        </u-form-item>
        <u-form-item label="表壳直径" prop="bkzj">
          <u-input v-model="strplist.product.bkzj" placeholder="请输入表壳直径" />
        </u-form-item>
        <u-form-item label="表壳厚度" prop="bkhd">
          <u-input v-model="strplist.product.bkhd" placeholder="请输入表壳厚度" />
        </u-form-item>
        <u-form-item label="表壳材质" prop="bkcz">
          <u-input v-model="strplist.product.bkcz" placeholder="请输入表壳材质" />
        </u-form-item>
        <u-form-item label="表带材质" prop="bdcz">
          <u-input v-model="strplist.product.bdcz" placeholder="请输入表带材质" />
        </u-form-item>
        <u-form-item label="机芯类型" prop="jxtype">
          <u-input v-model="strplist.product.jxtype" placeholder="请输入手表机芯类型" />
        </u-form-item>
        <u-form-item label="防水深度" prop="fssd">
          <u-input v-model="strplist.product.fssd" placeholder="请输入防水深度" />
        </u-form-item>
        <u-form-item label="上市时间">
          <u-input v-model="strplist.createtime_text" placeholder="申请时间" />
        </u-form-item>

        <!-- 全款 -->
        <u-form-item label="出售价" prop="price">
          <u-input v-model="strplist.product.price" placeholder="请填写出售价" />
        </u-form-item>
        <u-form-item label="官方售价" prop="price">
          <u-input v-model="strplist.product.offprice" placeholder="请填写官方售价" />
        </u-form-item>
        <!-- 商品描述 -->
        <u-form-item label="简介" prop="description" borderBottom>
          <u-textarea placeholder="不低于3个字" v-model="strplist.product.description" count></u-textarea>
        </u-form-item>

        <u-form-item label="视频上传:">
          <view class="vedio">
            <!-- 上传组件 -->
            <u-upload name="vedio" accept="video" :maxCount="1" :filelist="vediolist" width="100" height="100"
              @delete="delvedio" @afterRead="readvedio" />
          </view>
        </u-form-item>
        <!-- <u-action-sheet :show="showstore" :actions="stolist" title="请选所属的门店" @close="showstore = false"
          @select="storeSelect()">
        </u-action-sheet> -->
        <u-action-sheet :show="showsellcolumn" :actions="sellcolumnlist" title="请选择是否为推荐" @close="showsellcolumn = false"
          @select="sellcolumnSelect()">
        </u-action-sheet>





        <u-popup :show="showtype" @close="closeprotype" @open="openprotype">
          <view>
            <u-list height="560px">
              <u-list-item v-for="(item, index) in protypedata" :key="index">
                <view class="branktypename" @click="protypeSelect(item)">
                  <u-cell :title="item.name">

                  </u-cell>
                </view>
              </u-list-item>
            </u-list>
          </view>
        </u-popup>
        <u-popup :show="showstore" @close="closestore" @open="openstore">
          <view>
            <u-list height="560px">
              <u-list-item v-for="(item, index) in stolist" :key="index">
                <view class="branktypename" @click="storeSelect(item)">
                  <u-cell :title="item.name">

                  </u-cell>
                </view>
              </u-list-item>
            </u-list>
          </view>
        </u-popup>

        <u-popup :show="showbranktype" @close="close" @open="open">
          <view>
            <u-list height="560px">
              <u-list-item v-for="(item, index) in btypelist" :key="index">
                <view class="branktypename" @click="branktypeSelect(item)">
                  <u-cell :title="item.name">

                  </u-cell>
                </view>
              </u-list-item>
            </u-list>
          </view>
        </u-popup>

        <u-popup :show="showbrank" @close="closebrank" @open="openbrank">
          <view>
            <u-list height="560px">
              <u-list-item v-for="(item, index) in branklist" :key="index">
                <view class="branktypename" @click="brankSelect(item)">
                  <u-cell :title="item.name">

                  </u-cell>
                </view>
              </u-list-item>
            </u-list>
          </view>
        </u-popup>

        <!-- 提交按钮 -->
        <u-button text="审批" v-if="strplist.status == 1" icon="pushpin" size="small" type="primary" :customStyle="btnStyle"
          @click="product" />
        <u-button text="已审批" v-if="strplist.status == 2" :disabled="true" icon="pushpin" size="small" type="success"
          :customStyle="btnStyle" />

      </u-form>
    </view>
    <view class="content" v-else>
      <u-form labelPosition="left" labelWidth="60" :model="strplist" :rules="rules" ref="product">
        <!-- 部门 -->
        <u-form-item label="门店" prop="store" borderBottom @click="showstore = true">
          <u-input v-model="strplist.store.name" disabled disabledColor="#ffffff" placeholder="请选择所属门店"
            border="none"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <u-form-item label="商品分类" prop="store" borderBottom @click="showtype = true">
          <u-input v-model="strplist.hire.typename_text" disabled inputAlign="center" disabledColor="#ffffff"
            placeholder="请选择商品所属分类" border="none"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <!-- 品牌 -->
        <u-form-item label="品牌" prop="brank" borderBottom @click="showbrank = true">
          <u-input v-model="strplist.hire.brankname_text" disabled disabledColor="#ffffff" placeholder="请选择品牌"
            border="none"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <u-form-item label="系列" prop="branktype" borderBottom @click="showbranktype = true">
          <u-input v-model="strplist.hire.btypename_text" disabled disabledColor="#ffffff" placeholder="请选择系列"
            border="none"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <u-form-item label="推荐栏:  " borderBottom @click="showsellcolumn = true">
          <u-input v-model="strplist.hire.sellcolumn_text" inputAlign="center" disabled disabledColor="#ffffff"
            placeholder="请选择是否推荐" border="none"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>
        <!-- 名称 -->
        <u-form-item label="商品名称">
          <u-input v-model="strplist.hire.name" placeholder="请输入商品名称" />
        </u-form-item>
        <u-form-item label="客户昵称">
          <u-input v-model="strplist.business.nickname" placeholder="请输入客户昵称" />
        </u-form-item>
        <u-form-item label="客户电话">
          <u-input v-model="strplist.business.mobile" placeholder="请输入客户电话" />
          <u-button
          slot="right"
          :customStyle="{
            width: '40px',
            height: '35px',
            marginLeft: '3px',
          }"
          @tap="getbusinessPhone"
          :text="tips"
          type="success"
          :plain="true"
          size="mini"
        ></u-button>
        </u-form-item>
        <u-form-item label="审批状态">
          <u-input v-model="strplist.status_text" placeholder="审批状态未知" />
        </u-form-item>
        <u-form-item label="商品编号">
          <u-input v-model="strplist.hire.code" placeholder="请输入商品编号" />
        </u-form-item>
        <u-form-item label="品牌编号">
          <u-input v-model="strplist.hire.brankcode" placeholder="请输入品牌编号" />
        </u-form-item>
        <u-form-item label="颜色">
          <u-input v-model="strplist.hire.color" placeholder="请输入商品颜色" />
        </u-form-item>
        <u-form-item label="商品成分">
          <u-input v-model="strplist.hire.ingredients" placeholder="请输入商品成分" />
        </u-form-item>
        <u-form-item label="商品属性">
          <u-input v-model="strplist.hire.prop" placeholder="请输入商品属性" />
        </u-form-item>
        <u-form-item label="商品长度">
          <u-input v-model="strplist.hire.prowidth" placeholder="请输入商品长度" />
        </u-form-item>
        <u-form-item label="上市时间">
          <u-input v-model="strplist.createtime_text" placeholder="申请时间" />
        </u-form-item>

        <!-- 全款 -->
        <u-form-item label="出售价">
          <u-input v-model="strplist.hire.price" placeholder="请填写出售价" />
        </u-form-item>
        <u-form-item label="官方售价">
          <u-input v-model="strplist.hire.offprice" placeholder="请填写官方售价" />
        </u-form-item>
        <!-- 商品描述 -->
        <u-form-item label="简介" orderBottom>
          <u-textarea placeholder="不低于3个字" v-model="strplist.hire.content" count></u-textarea>
        </u-form-item>

        <!-- <u-form-item label="视频上传:">
          <view class="vedio">
            <u-upload name="vedio" accept="video" :maxCount="1" :filelist="vediolist" width="100" height="100"
              @delete="delvedio" @afterRead="readvedio" />
          </view>
        </u-form-item> -->
        <!-- <u-action-sheet :show="showstore" :actions="stolist" title="请选所属的门店" @close="showstore = false"
          @select="storeSelect()">
        </u-action-sheet> -->
        <u-action-sheet :show="showsellcolumn" :actions="sellcolumnlist" title="请选择是否为推荐" @close="showsellcolumn = false"
          @select="sellcolumnSelect()">
        </u-action-sheet>





        <u-popup :show="showtype" @close="closeprotype" @open="openprotype">
          <view>
            <u-list height="560px">
              <u-list-item v-for="(item, index) in protypedata" :key="index">
                <view class="branktypename" @click="protypeSelect(item)">
                  <u-cell :title="item.name">

                  </u-cell>
                </view>
              </u-list-item>
            </u-list>
          </view>
        </u-popup>
        <u-popup :show="showstore" @close="closestore" @open="openstore">
          <view>
            <u-list height="560px">
              <u-list-item v-for="(item, index) in stolist" :key="index">
                <view class="branktypename" @click="storeSelect(item)">
                  <u-cell :title="item.name">

                  </u-cell>
                </view>
              </u-list-item>
            </u-list>
          </view>
        </u-popup>

        <u-popup :show="showbranktype" @close="close" @open="open">
          <view>
            <u-list height="560px">
              <u-list-item v-for="(item, index) in btypelist" :key="index">
                <view class="branktypename" @click="branktypeSelect(item)">
                  <u-cell :title="item.name">

                  </u-cell>
                </view>
              </u-list-item>
            </u-list>
          </view>
        </u-popup>

        <u-popup :show="showbrank" @close="closebrank" @open="openbrank">
          <view>
            <u-list height="560px">
              <u-list-item v-for="(item, index) in branklist" :key="index">
                <view class="branktypename" @click="brankSelect(item)">
                  <u-cell :title="item.name">

                  </u-cell>
                </view>
              </u-list-item>
            </u-list>
          </view>
        </u-popup>
        <!-- 提交按钮 -->
        <u-button text="审批" v-if="strplist.status == 1" icon="pushpin" size="small" type="primary" :customStyle="btnStyle"
          @click="product" />
        <u-button text="已审批" v-if="strplist.status == 2" :disabled="true" icon="pushpin" size="small" type="success"
          :customStyle="btnStyle" />

      </u-form>
    </view>


    <!-- 消息提醒 -->
    <u-toast ref="notice"></u-toast>
  </view>
</template>
  
<script>
export default {
  onLoad(options) {
    this.strpid = options.strpid ? options.strpid : 0;
    this.busid = options.busid ? options.busid : 0

    this.auth = this.$u.auth.check()
    this.storelist()
    this.watchinfo()
    this.getproducttype()
    this.brank()
  },
  onReady() {
    this.$refs.product.setRules(this.rules);
  },

  created() {
    this.timer = setInterval(() => {
      let a = this.$u.count.check();
    }, 15000);
  },
  beforeDestroy() {
    clearInterval(this.timer);
  },
  data() {
    return {
      showCalendar: false,
      strpid: 0,
      showtype: false,
      status: 0,
      busid:0,
      sellcolumnlist: [
        {
          sellcolumn: 0,
          name: "正常",
        },
        {
          sellcolumn: 1,
          name: "推荐",
        },
      ],
      hireid: 0,
      piclist: [],
      piclist1: [],
      filelist: [],
      showstore: false,
      showbrank: false,
      showbranktype: false,
      stolist: [],
      branklist: [],
      showsellcolumn: false,
      showsellcolumn1: false,

      filelist1: [],
      branktypelist: [],

      product_img: "",
      xsz_img: "",
      protypedata: [],
      auth: {},
      strplist: {
        store: {
          name: "",
        },
        brank: {
          name: "",
        },

        business: {
          nickname: "",
        },
        hire: {
          ptypeid: "",
          btypeid: "",
          brand_id: "",
          code: "",
          brankcode: "",
          name: "",
          prowidth: "",
          ingredients: "",
          product_img: "",
          prop: "",
          emission: "",
          exprice: "",
          content: "",
        },
        product: {
          product_img: "",

        }

      },
      showbrank: false,
      param1: "",
      tips: "拨打",
      btypelist: [],
      soure: "",
      sf: 0,
      description: "",
      price: 0,
      rules: {
        "product.description": {
          required: true,
          message: "不低于3个字",
          trigger: ["change"],
        },
        "store.name": {
          required: true,
          message: "请选择你所属的门店",
          trigger: ["blur", "change"],
        },
        "brank.name": {
          required: true,
          message: "请选择你所属的品牌",
          trigger: ["blur", "change"],
        },
        "btype.name": {
          required: true,
          message: "请选择你所属的品牌系列",
          trigger: ["blur", "change"],
        },
        "product.name": {
          required: true,
          message: "请填写商品名称",
          trigger: ["blur", "change"],
        },

        "product.price": {
          required: true,
          message: "请填写出售价",
          trigger: ["blur", "change"],
        },
        "product.offprice": {
          required: true,
          message: "请填写官方售价",
          trigger: ["blur", "change"],
        },


        "product.jxtype": {
          required: true,
          message: "请填写机芯类型",
          trigger: ["blur", "change"],
        },
        "product.bkzj": {
          required: true,
          message: "请填写手表直径",
          trigger: ["blur", "change"],
        },
        "product.bkhd": {
          required: true,
          message: "请填写表壳厚度",
          trigger: ["blur", "change"],
        },
        "product.bkcz": {
          required: true,
          message: "请填写表壳材质",
          trigger: ["blur", "change"],
        },
        "product.bdcz": {
          required: true,
          message: "请填写表带材质",
          trigger: ["blur", "change"],
        },
        "product.fssd": {
          required: true,
          message: "请填写防水深度",
          trigger: ["blur", "change"],
        },
      },
    };
  },

  methods: {

    getbusinessPhone() {
      wx.makePhoneCall({
        phoneNumber: this.strplist.business.mobile, //仅为示例，并非真实的电话号码
      });
    },

    open() {
      this.showbranktype = true;
      // console.log('close');
    },

    close() {
      this.showbranktype = false;
      // console.log('close');
    },
    openstore() {
      this.showstore = true;
      // console.log('close');
    },

    closestore() {
      this.showstore = false;
      // console.log('close');
    },
    closeprotype() {
      this.showtype = false;
      // console.log('close');
    },
    openprotype() {
      this.showtype = true;
      // console.log('close');
    },
    openbrank() {
      this.showbrank = true;
      // console.log('close');
    },

    closebrank() {
      this.showstore = false;
      // console.log('close');
    },
    async getproducttype() {
      let data = {
        adminid: this.auth.id,
      };

      let result = await this.$u.api.product.getprotypedata(data);

      if (result.code) {
        this.protypedata = result.data;
      }
    },
    async getbranktype(e) {
      let data = {
        adminid: this.auth.id,
        brand_id: e,
      };

      let result = await this.$u.api.product.getbtypelist(data);

      if (result.code) {
        this.btypelist = result.data;
      }
    },
    //
    branktypeSelect(e) {
      this.strplist.product.btypename_text = e.name;
      this.strplist.product.btypeid = e.id;
      this.showbranktype = false
    },

    del(e) {
      let list = this.filelist.map(async (item, index) => {
        // this.filelist(index, 1)

        if (index == e.index) {
          // 删除数组中的某一项

          this.filelist.splice(e.index, index);
          let data = {
            proid: this.proid,
            product_img: e.file.url,
          };
          var result = await this.$u.api.product.delthumb(data);

          if (result.code) {
            this.filelist.splice(e.index, e.index);

            this.$refs.notice.show({
              type: "success",
              message: result.msg,
              duration: 2000,
              complete: () => {
                this.watchinfo()
                if(this.filelist.length==1){

                  this.filelist = [];
                }
              },
            });
            return false;
          }
        }
      });
    },
    async read(event) {
      //组装上传数据
      var data = {
        filePath: event.file.thumb,
        name: "product_img",
        header: {},
        formData: {
          proid: this.proid,
        },
      };

      //调用接口
      var result = await this.$u.api.product.thumbs(data);

      if (result.code) {
        // 合并对象
        this.filelist = this.filelist.concat({ url: result.data });

        let userArray = Object.entries(this.filelist).map(([key, value]) => {
          return { value };
        });

        userArray.forEach((item) => {
          // 把想要的路径追加到数组
          this.piclist.push(item.value.url);
        });

        // 数组的去重
        let qcarr = [...new Set(this.piclist)];

        // 数组转化成字符串
        this.strplist.product.product_img = qcarr.join(",");
      } else {
        this.$refs.notice.show({
          type: "error",
          message: result.msg,
        });
        return false;
      }
    },
    del1(e) {
      let list = this.filelist.map(async (item, index) => {
        // this.filelist(index, 1)

        if (index == e.index) {
          // 删除数组中的某一项

          this.filelist1.splice(e.index, index);
          let data = {
            hireid: this.hireid,
            product_img: e.file.url,
          };
          var result = await this.$u.api.hire.delthumb(data);

          if (result.code) {
            this.filelist1.splice(e.index, e.index);

            this.$refs.notice.show({
              type: "success",
              message: result.msg,
              duration: 2000,
              complete: () => {
                this.watchinfo()
                if (this.fileList1.length==1) {

                  this.filelist1 = [];
                }
              },
            });
            return false;
          }
        }
      });
    },
    async read1(event) {
      //组装上传数据
      var data = {
        filePath: event.file.thumb,
        name: "product_img",
        header: {},
        formData: {
          hireid: this.hireid,
        },
      };

      //调用接口
      var result = await this.$u.api.product.thumbs(data);

      if (result.code) {
        // 合并对象
        this.filelist1 = this.filelist1.concat({ url: result.data });

        let userArray = Object.entries(this.filelist1).map(([key, value]) => {
          return { value };
        });

        userArray.forEach((item) => {
          // 把想要的路径追加到数组
          this.piclist1.push(item.value.url);
        });

        // 数组的去重
        let qcarr = [...new Set(this.piclist1)];

        // 数组转化成字符串
        this.strplist.hire.product_img = qcarr.join(",");
      } else {
        this.$refs.notice.show({
          type: "error",
          message: result.msg,
        });
        return false;
      }
    },
    async readvedio(item) {
      //组装上传数据
      var data = {
        filePath: item.file.url,
        name: "vedio",
        header: {},
      };

      //调用接口
      var result = await this.$u.api.product.vedioupload(data);

      if (result.code) {
        this.vediolist = [{ url: result.data }];

        //修改本地存储中的图像内容
        this.strplist.vedio = result.data;
      } else {
        this.$refs.notice.show({
          type: "error",
          message: result.msg,
        });
        return false;
      }
    },
    // 手表详情
    async watchinfo() {
      let data = {
        adminid: this.auth.id,
        strpid: this.strpid,
        busid:this.busid
      };

      let result = await this.$u.api.depot.ShenpiInfo(data);
      {
        if (result.code) {
          this.strplist = result.data;


          if (this.strplist.pro_imglist.length > 0) {
            this.filelist = this.strplist.pro_imglist.map((item) => {
              return {
                url: item,
              };
            });
          } else {
            this.filelist = [];
          }
          if (this.strplist.hire_imglist.length > 0) {
            this.filelist1 = this.strplist.hire_imglist.map((item) => {
              return {
                url: item,
              };
            });
          } else {
            this.filelist1 = [];
          }
        } else {
          this.$refs.notice.show({
            type: "warning",
            message: result.msg,
            duration: 1200,
            complete: () => {
              uni.$u.route({
                type: "navigateBack",
                delta: 1,
              });

              return false;
            },
          });
        }
      }
    },
    sellcolumnSelect(e) {
      this.strplist.product.sellcolumn_text = e.name;
      this.strplist.product.sellcolumn = e.sellcolumn;
    },
    brankSelect(e) {
      this.strplist.product.brankname_text = e.name;
      this.strplist.product.brand_id = e.id;
      this.showbrank = false

      this.getbranktype(e.id);
    },
    protypeSelect(e) {
      this.strplist.product.typename_text = e.name,
        this.strplist.product.ptypeid = e.id;
      this.showtype = false
    },
    storeSelect(e) {
      this.strplist.store.name = e.name;
      this.strplist.stoid = e.id;
      this.showstore = false
    },
    product() {
      this.$refs.product
        .validate()
        .then(async () => {
          let data = {
            id: this.strplist.id,
            adminid: this.auth.id,
            busid:this.busid,
            strpid:this.strpid,
            stoid: this.strplist.product.stoid,
          
            // name: this.strplist.product.name,
            product: {
              jxtype: this.strplist.product.jxtype,
              bkcz: this.strplist.product.bkcz,
              product_img: this.strplist.product.product_img,
              bkhd: this.strplist.product.bkhd,
              bkzj: this.strplist.product.bkzj,
              price: this.strplist.product.price,
              offprice: this.strplist.product.offprice,
              stoid: this.strplist.product.stoid,
              brand_id: this.strplist.product.brand_id,
              btypeid: this.strplist.product.btypeid,
              sellcolumn: this.strplist.product.sellcolumn,
              fssd: this.strplist.product.fssd,
              code: this.strplist.product.code,
              ptypeid: this.strplist.product.ptypeid,
              description: this.strplist.product.description,
            },
            hire: {
              ptypeid: this.strplist.hire.ptypeid,
              btypeid: this.strplist.hire.btypeid,
              brand_id: this.strplist.hire.brand_id,
              code: this.strplist.hire.code,
              brankcode: this.strplist.hire.brankcode,
              name: this.strplist.hire.name,
              prowidth: this.strplist.hire.prowidth,
              ingredients: this.strplist.hire.ingredients,
              product_img: this.strplist.hire.product_img,
              prop: this.strplist.prop,
              price: this.strplist.price,
              content: this.strplist.hire.content,

            }

          };


          let result = await this.$u.api.depot.shenpiconfirm(data);

          if (result.code) {
            this.$refs.notice.show({
              type: "success",
              message: result.msg,
              duration: 1000,
              complete: () => {
                //返回上一个界面
                uni.$u.route({
                  type: "redirectTo",
                  url: "/pagesC/shenpi/index",
                
                });
              },
            });
          } else {
            this.$refs.notice.show({
              type: "danger",
              message: result.msg,
              duration: 2000,
            });
          }
        })
        .catch(() => {
          uni.$u.toast("效验失败");
        });
    },

    async storelist() {
      let data = {
        adminid: this.auth.id,
        stoid: this.auth.stoid,
      };
      let result = await this.$u.api.product.storelist(data);

      if (result.code) {
        this.stolist = result.data;
      }
    },
    async brank() {
      let result = await this.$u.api.product.branks({
        adminid: this.auth.id,
        stoid: this.auth.id,
      });

      if (result.code) {
        this.branklist = result.data;
      } else {
        this.$refs.notice.show({
          type: "danger",
          message: result.msg,
        });
      }
    },





    // 拨打电话
    getPhone() {
      wx.makePhoneCall({
        phoneNumber: this.strplist.supplier.mobile, //仅为示例，并非真实的电话号码
      });
    },
    getbusinessPhone() {
      wx.makePhoneCall({
        phoneNumber: this.strplist.business.mobile, //仅为示例，并非真实的电话号码
      });
    },
  },
};
</script>
  
<style >
.content {
  padding: 20px;
}

.container {
  height: 100%;
  margin: 0 50rpx;
  box-sizing: border-box;
}

.avatar {
  text-align: center;
}

.u-avatar {
  margin: 80rpx auto 40rpx;
}

.xcx {
  width: 200rpx;
  height: 200rpx;
  margin: 80rpx auto 40rpx;
  border-radius: 100%;
  overflow: hidden;
}

.nickname {
  font-size: 14px;
  text-align: center;
}

.title {
  text-align: center;
  margin: 40rpx 0;
  font-size: 14rpx;
}

.avatar .u-upload {
  justify-content: center;
  align-items: center;
  margin: 3em auto;
}

/* .u-form-item__body__left__content__label.data-v-5e7216f1 {
	width: 75px;
} */

.vedio .u-upload {
  justify-content: center;
  align-items: center;
  margin: 0.3em auto;
}

.vedio {
  text-align: center;
}

.u-vedio {
  margin: 80rpx auto 40rpx;
}

.branktypename {
  text-align: center;
}</style>
  